package test4;

import java.util.Scanner;

public class StringDemo {
    public static String getBigNumber(int number){
        String[] array ={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
        return array[number];
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int money;
        while (true) {
            System.out.println("请输入一个金额");
            money = sc.nextInt();
            if (money >= 0 && money <10000000) {
                break;
            } else {
                System.out.println("无效的金额输入");
            }
        }
        String moneyBig="";
        while(true){
            int num=money%10;
            String bigNumber = getBigNumber(num);
            moneyBig=bigNumber+moneyBig;
            money=money/10;
            if(money==0){
                break;
            }
        }
        int count=7-moneyBig.length();
        for(int i=0;i<count;i++){
            moneyBig="零"+moneyBig;
        }

        String result="";
        String[] array={"佰","拾","万","仟","佰","拾","元"};
        for(int i=0;i<moneyBig.length();i++){
            char ch=moneyBig.charAt(i);
            result=result+ch+array[i];
        }
        System.out.println(result);
    }
}
